//
//  MLAPropertyRepairCell.m
//  MagicLampApp
//
//  Created by Zheng on 2018/12/24.
//  Copyright © 2018 zheng.magic.lamp.app. All rights reserved.
//

#import "MLAPropertyRepairCell.h"
#import "MLAPropertyRepairModel.h"

@implementation MLAPropertyRepairCell {
    UILabel *titleLbl;
    UILabel *addressLbl;
    UILabel *des1Lbl;
    UILabel *des2Lbl;
    UILabel *userLbl;
    UILabel *dateLbl;
    
    UILabel *stateLbl;
}

- (void)setModel:(MLAPropertyRepairModel *)model {
    _model = model;
    
    dateLbl.text = _model.ctime;
    userLbl.text = [NSString stringWithFormat:@"%@：%@",_model.form_name,_model.phone];
    addressLbl.text = _model.address;
    des2Lbl.text = _model.content;
    des1Lbl.text = _model.title;

    if (_model.dispose_type.integerValue == 1) {
        titleLbl.text = @"已报修";
        stateLbl.hidden = YES;
    } else {
        titleLbl.text = @"已修理";
        stateLbl.hidden = NO;
    }
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        titleLbl = [[UILabel alloc] init];
        titleLbl.textColor = CX_GetColorTitle();
        titleLbl.font = CX_GetNormalFont(16);
        [self.shadowView addSubview:titleLbl];
        [titleLbl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(15);
            make.top.mas_equalTo(19);
        }];
        
        UIColor *color = CX_GetColorHex(0x6B7178, 1);
        
        addressLbl = [[UILabel alloc] init];
        addressLbl.textColor = color;
        addressLbl.font = CX_GetNormalFont(12);
        [self.shadowView addSubview:addressLbl];
        [addressLbl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(15);
            make.top.equalTo(self->titleLbl.mas_bottom).offset(8);
        }];
        
        des1Lbl = [[UILabel alloc] init];
        des1Lbl.textColor = color;
        des1Lbl.font = CX_GetNormalFont(12);
        [self.shadowView addSubview:des1Lbl];
        [des1Lbl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(15);
            make.top.equalTo(self->addressLbl.mas_bottom).offset(8);
        }];
        
        des2Lbl = [[UILabel alloc] init];
        des2Lbl.textColor = color;
        des2Lbl.font = CX_GetNormalFont(12);
        [self.shadowView addSubview:des2Lbl];
        [des2Lbl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(15);
            make.top.equalTo(self->des1Lbl.mas_bottom).offset(8);
        }];

        userLbl = [[UILabel alloc] init];
        userLbl.textColor = color;
        userLbl.font = CX_GetNormalFont(12);
        [self.shadowView addSubview:userLbl];
        [userLbl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(15);
            make.top.equalTo(self->des2Lbl.mas_bottom).offset(8);
        }];

        dateLbl = [[UILabel alloc] init];
        dateLbl.textColor = color;
        dateLbl.font = CX_GetNormalFont(10);
        [self.shadowView addSubview:dateLbl];
        [dateLbl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.mas_equalTo(-15);
            make.top.mas_equalTo(23);
        }];

        stateLbl = [[UILabel alloc] init];
        stateLbl.textColor = CX_GetColorBlue();
        stateLbl.font = CX_GetNormalFont(12);
        stateLbl.text = @"已修理完毕";
        stateLbl.hidden = YES;
        [self.shadowView addSubview:stateLbl];
        [stateLbl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.mas_equalTo(-15);
            make.centerY.equalTo(self->userLbl);
        }];
        
//        _evaluteBtn = [UIButton buttonWithType:UIButtonTypeCustom];
//        [_evaluteBtn setTitle:@"评价" forState:UIControlStateNormal];
//        [_evaluteBtn setTitleColor:CX_GetColorBlue() forState:UIControlStateNormal];
//        _evaluteBtn.titleLabel.font = CX_GetNormalFont(14);
//        _evaluteBtn.layer.borderColor = CX_GetColorBlue().CGColor;
//        _evaluteBtn.layer.borderWidth = 1;
//        _evaluteBtn.layer.cornerRadius = 5;
//        _evaluteBtn.layer.masksToBounds = YES;
////        _evaluteBtn.hidden = YES;
//        [self.shadowView addSubview:_evaluteBtn];
//        [_evaluteBtn mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.right.mas_equalTo(-15);
//            make.centerY.equalTo(self->stateLbl);
//            make.width.mas_equalTo(100);
//            make.height.mas_equalTo(30);
//        }];

    }
    return self;
}





@end
